﻿<sap:ActivityDesigner x:Class="Neovolve.Toolkit.Workflow.Design.Presentation.InstanceResolverDesigner"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:s="clr-namespace:System;assembly=mscorlib"
                      xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
                      xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation"
                      xmlns:conv="clr-namespace:System.Activities.Presentation.Converters;assembly=System.Activities.Presentation"
                      xmlns:sadm="clr-namespace:System.Activities.Presentation.Model;assembly=System.Activities.Presentation"
                      xmlns:ComponentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
                      xmlns:ntw="clr-namespace:Neovolve.Toolkit.Workflow;assembly=Neovolve.Toolkit.Workflow"
                      xmlns:ntwd="clr-namespace:Neovolve.Toolkit.Workflow.Design">
	<sap:ActivityDesigner.Icon>
		<DrawingBrush>
			<DrawingBrush.Drawing>
				<ImageDrawing>
					<ImageDrawing.Rect>
						<Rect Location="0,0"
						      Size="16,16">
						</Rect>
					</ImageDrawing.Rect>
					<ImageDrawing.ImageSource>
						<BitmapImage UriSource="brick.png"></BitmapImage>
					</ImageDrawing.ImageSource>
				</ImageDrawing>
			</DrawingBrush.Drawing>
		</DrawingBrush>
	</sap:ActivityDesigner.Icon>
	<sap:ActivityDesigner.Resources>
    <conv:ModelToObjectValueConverter x:Key="modelItemConverter"
		                                  x:Uid="sadm:ModelToObjectValueConverter_1" />
		<conv:ArgumentToExpressionConverter x:Key="expressionConverter" />
		<ObjectDataProvider MethodName="GetValues"
		                    ObjectType="{x:Type s:Enum}"
		                    x:Key="EnumSource">
			<ObjectDataProvider.MethodParameters>
				<x:Type TypeName="ntw:GenericArgumentCount" />
			</ObjectDataProvider.MethodParameters>
		</ObjectDataProvider>
		<DataTemplate x:Key="Collapsed">
			<TextBlock HorizontalAlignment="Center"
			           FontStyle="Italic"
			           Foreground="Gray">
				Double-click to view
			</TextBlock>
		</DataTemplate>
		<DataTemplate x:Key="Expanded">
			<Grid>
				<Grid.RowDefinitions>
					<RowDefinition Height="Auto" />
					<RowDefinition Height="*" />
				</Grid.RowDefinitions>
        <StackPanel Orientation="Vertical">
          <StackPanel Orientation="Horizontal"
				            Margin="2">
            <TextBlock VerticalAlignment="Center">Argument Count:</TextBlock>
            <ComboBox x:Name="ArgumentCountList"
					          ItemsSource="{Binding Source={StaticResource EnumSource}}"
					          SelectedItem="{Binding Path=ModelItem.Arguments, Mode=TwoWay}"/>
          </StackPanel>

          <StackPanel Orientation="Horizontal"
				            Margin="2" Visibility="{Binding Path=ModelItem.ArgumentVisible}">
            <sapv:TypePresenter Width="120"
					                    Margin="5"
					                    AllowNull="false"
					                    BrowseTypeDirectly="false"
					                    Label="Target type"
					                    Type="{Binding Path=ModelItem.ArgumentType, Mode=TwoWay, Converter={StaticResource modelItemConverter}}"
					                    Context="{Binding Context}" />
            <TextBox Text="{Binding ModelItem.Body.Argument1.Name}"
					         MinWidth="80" />
            <TextBlock VerticalAlignment="Center"
					           Margin="2">
						with name
            </TextBlock>
            <sapv:ExpressionTextBox Expression="{Binding Path=ModelItem.ResolutionName1, Converter={StaticResource expressionConverter}}"
					                        ExpressionType="s:String"
					                        OwnerActivity="{Binding ModelItem}"
					                        Margin="2" />
          </StackPanel>

          <StackPanel Orientation="Horizontal"
				            Margin="2" Visibility="{Binding Path=ModelItem.Argument1Visible}">
            <sapv:TypePresenter Width="120"
					                    Margin="5"
					                    AllowNull="false"
					                    BrowseTypeDirectly="false"
					                    Label="Target type"
					                    Type="{Binding Path=ModelItem.ArgumentType1, Mode=TwoWay, Converter={StaticResource modelItemConverter}}"
					                    Context="{Binding Context}" />
            <TextBox Text="{Binding ModelItem.Body.Argument1.Name}"
					         MinWidth="80" />
            <TextBlock VerticalAlignment="Center"
					           Margin="2">
						with name
            </TextBlock>
            <sapv:ExpressionTextBox Expression="{Binding Path=ModelItem.ResolutionName1, Converter={StaticResource expressionConverter}}"
					                        ExpressionType="s:String"
					                        OwnerActivity="{Binding ModelItem}"
					                        Margin="2" />
          </StackPanel>

          <StackPanel Orientation="Horizontal"
				            Margin="2"
				            Grid.Row="2" Visibility="{Binding Path=ModelItem.Argument2Visible}">
            <sapv:TypePresenter Width="120"
					                    Margin="5"
					                    AllowNull="true"
					                    BrowseTypeDirectly="false"
					                    Label="Target type"
					                    Type="{Binding Path=ModelItem.ArgumentType2, Mode=TwoWay, Converter={StaticResource modelItemConverter}}"
					                    Context="{Binding Context}" />
            <TextBox Text="{Binding ModelItem.Body.Argument2.Name}"
					         MinWidth="80" />

            <TextBlock VerticalAlignment="Center"
					           Margin="2">
						with name
            </TextBlock>

            <sapv:ExpressionTextBox Expression="{Binding Path=ModelItem.ResolutionName2, Converter={StaticResource expressionConverter}}"
					                        ExpressionType="s:String"
					                        OwnerActivity="{Binding ModelItem}"
					                        Margin="2" />
          </StackPanel>

          <StackPanel Orientation="Horizontal"
				            Margin="2"
				            Grid.Row="2" Visibility="{Binding Path=ModelItem.Argument3Visible}">
            <sapv:TypePresenter Width="120"
					                    Margin="5"
					                    AllowNull="true"
					                    BrowseTypeDirectly="false"
					                    Label="Target type"
					                    Type="{Binding Path=ModelItem.ArgumentType3, Mode=TwoWay, Converter={StaticResource modelItemConverter}}"
					                    Context="{Binding Context}" />
            <TextBox Text="{Binding ModelItem.Body.Argument3.Name}"
					         MinWidth="80" />

            <TextBlock VerticalAlignment="Center"
					           Margin="2">
						with name
            </TextBlock>

            <sapv:ExpressionTextBox Expression="{Binding Path=ModelItem.ResolutionName3, Converter={StaticResource expressionConverter}}"
					                        ExpressionType="s:String"
					                        OwnerActivity="{Binding ModelItem}"
					                        Margin="2" />
          </StackPanel>

          <StackPanel Orientation="Horizontal"
				            Margin="2"
				            Grid.Row="2" Visibility="{Binding Path=ModelItem.Argument4Visible}">
            <sapv:TypePresenter Width="120"
					                    Margin="5"
					                    AllowNull="true"
					                    BrowseTypeDirectly="false"
					                    Label="Target type"
					                    Type="{Binding Path=ModelItem.ArgumentType4, Mode=TwoWay, Converter={StaticResource modelItemConverter}}"
					                    Context="{Binding Context}" />
            <TextBox Text="{Binding ModelItem.Body.Argument4.Name}"
					         MinWidth="80" />

            <TextBlock VerticalAlignment="Center"
					           Margin="2">
						with name
            </TextBlock>

            <sapv:ExpressionTextBox Expression="{Binding Path=ModelItem.ResolutionName4, Converter={StaticResource expressionConverter}}"
					                        ExpressionType="s:String"
					                        OwnerActivity="{Binding ModelItem}"
					                        Margin="2" />
          </StackPanel>

          <StackPanel Orientation="Horizontal"
				            Margin="2"
				            Grid.Row="2" Visibility="{Binding Path=ModelItem.Argument5Visible}">
            <sapv:TypePresenter Width="120"
					                    Margin="5"
					                    AllowNull="true"
					                    BrowseTypeDirectly="false"
					                    Label="Target type"
					                    Type="{Binding Path=ModelItem.ArgumentType5, Mode=TwoWay, Converter={StaticResource modelItemConverter}}"
					                    Context="{Binding Context}" />
            <TextBox Text="{Binding ModelItem.Body.Argument5.Name}"
					         MinWidth="80" />

            <TextBlock VerticalAlignment="Center"
					           Margin="2">
						with name
            </TextBlock>

            <sapv:ExpressionTextBox Expression="{Binding Path=ModelItem.ResolutionName5, Converter={StaticResource expressionConverter}}"
					                        ExpressionType="s:String"
					                        OwnerActivity="{Binding ModelItem}"
					                        Margin="2" />
          </StackPanel>

          <StackPanel Orientation="Horizontal"
				            Margin="2"
				            Grid.Row="2" Visibility="{Binding Path=ModelItem.Argument6Visible}">
            <sapv:TypePresenter Width="120"
					                    Margin="5"
					                    AllowNull="true"
					                    BrowseTypeDirectly="false"
					                    Label="Target type"
					                    Type="{Binding Path=ModelItem.ArgumentType6, Mode=TwoWay, Converter={StaticResource modelItemConverter}}"
					                    Context="{Binding Context}" />
            <TextBox Text="{Binding ModelItem.Body.Argument6.Name}"
					         MinWidth="80" />

            <TextBlock VerticalAlignment="Center"
					           Margin="2">
						with name
            </TextBlock>

            <sapv:ExpressionTextBox Expression="{Binding Path=ModelItem.ResolutionName6, Converter={StaticResource expressionConverter}}"
					                        ExpressionType="s:String"
					                        OwnerActivity="{Binding ModelItem}"
					                        Margin="2" />
          </StackPanel>

          <StackPanel Orientation="Horizontal"
				            Margin="2"
				            Grid.Row="2" Visibility="{Binding Path=ModelItem.Argument7Visible}">
            <sapv:TypePresenter Width="120"
					                    Margin="5"
					                    AllowNull="true"
					                    BrowseTypeDirectly="false"
					                    Label="Target type"
					                    Type="{Binding Path=ModelItem.ArgumentType7, Mode=TwoWay, Converter={StaticResource modelItemConverter}}"
					                    Context="{Binding Context}" />
            <TextBox Text="{Binding ModelItem.Body.Argument7.Name}"
					         MinWidth="80" />

            <TextBlock VerticalAlignment="Center"
					           Margin="2">
						with name
            </TextBlock>

            <sapv:ExpressionTextBox Expression="{Binding Path=ModelItem.ResolutionName7, Converter={StaticResource expressionConverter}}"
					                        ExpressionType="s:String"
					                        OwnerActivity="{Binding ModelItem}"
					                        Margin="2" />
          </StackPanel>

          <StackPanel Orientation="Horizontal"
				            Margin="2"
				            Grid.Row="2" Visibility="{Binding Path=ModelItem.Argument8Visible}">
            <sapv:TypePresenter Width="120"
					                    Margin="5"
					                    AllowNull="true"
					                    BrowseTypeDirectly="false"
					                    Label="Target type"
					                    Type="{Binding Path=ModelItem.ArgumentType8, Mode=TwoWay, Converter={StaticResource modelItemConverter}}"
					                    Context="{Binding Context}" />
            <TextBox Text="{Binding ModelItem.Body.Argument8.Name}"
					         MinWidth="80" />

            <TextBlock VerticalAlignment="Center"
					           Margin="2">
						with name
            </TextBlock>

            <sapv:ExpressionTextBox Expression="{Binding Path=ModelItem.ResolutionName8, Converter={StaticResource expressionConverter}}"
					                        ExpressionType="s:String"
					                        OwnerActivity="{Binding ModelItem}"
					                        Margin="2" />
          </StackPanel>

          <StackPanel Orientation="Horizontal"
				            Margin="2"
				            Grid.Row="2" Visibility="{Binding Path=ModelItem.Argument9Visible}">
            <sapv:TypePresenter Width="120"
					                    Margin="5"
					                    AllowNull="true"
					                    BrowseTypeDirectly="false"
					                    Label="Target type"
					                    Type="{Binding Path=ModelItem.ArgumentType9, Mode=TwoWay, Converter={StaticResource modelItemConverter}}"
					                    Context="{Binding Context}" />
            <TextBox Text="{Binding ModelItem.Body.Argument9.Name}"
					         MinWidth="80" />

            <TextBlock VerticalAlignment="Center"
					           Margin="2">
						with name
            </TextBlock>

            <sapv:ExpressionTextBox Expression="{Binding Path=ModelItem.ResolutionName9, Converter={StaticResource expressionConverter}}"
					                        ExpressionType="s:String"
					                        OwnerActivity="{Binding ModelItem}"
					                        Margin="2" />
          </StackPanel>

          <StackPanel Orientation="Horizontal"
				            Margin="2"
				            Grid.Row="2" Visibility="{Binding Path=ModelItem.Argument10Visible}">
            <sapv:TypePresenter Width="120"
					                    Margin="5"
					                    AllowNull="true"
					                    BrowseTypeDirectly="false"
					                    Label="Target type"
					                    Type="{Binding Path=ModelItem.ArgumentType10, Mode=TwoWay, Converter={StaticResource modelItemConverter}}"
					                    Context="{Binding Context}" />
            <TextBox Text="{Binding ModelItem.Body.Argument10.Name}"
					         MinWidth="80" />

            <TextBlock VerticalAlignment="Center"
					           Margin="2">
						with name
            </TextBlock>

            <sapv:ExpressionTextBox Expression="{Binding Path=ModelItem.ResolutionName10, Converter={StaticResource expressionConverter}}"
					                        ExpressionType="s:String"
					                        OwnerActivity="{Binding ModelItem}"
					                        Margin="2" />
          </StackPanel>

          <StackPanel Orientation="Horizontal"
				            Margin="2"
				            Grid.Row="2" Visibility="{Binding Path=ModelItem.Argument11Visible}">
            <sapv:TypePresenter Width="120"
					                    Margin="5"
					                    AllowNull="true"
					                    BrowseTypeDirectly="false"
					                    Label="Target type"
					                    Type="{Binding Path=ModelItem.ArgumentType11, Mode=TwoWay, Converter={StaticResource modelItemConverter}}"
					                    Context="{Binding Context}" />
            <TextBox Text="{Binding ModelItem.Body.Argument11.Name}"
					         MinWidth="80" />

            <TextBlock VerticalAlignment="Center"
					           Margin="2">
						with name
            </TextBlock>

            <sapv:ExpressionTextBox Expression="{Binding Path=ModelItem.ResolutionName11, Converter={StaticResource expressionConverter}}"
					                        ExpressionType="s:String"
					                        OwnerActivity="{Binding ModelItem}"
					                        Margin="2" />
          </StackPanel>

          <StackPanel Orientation="Horizontal"
				            Margin="2"
				            Grid.Row="2" Visibility="{Binding Path=ModelItem.Argument12Visible}">
            <sapv:TypePresenter Width="120"
					                    Margin="5"
					                    AllowNull="true"
					                    BrowseTypeDirectly="false"
					                    Label="Target type"
					                    Type="{Binding Path=ModelItem.ArgumentType12, Mode=TwoWay, Converter={StaticResource modelItemConverter}}"
					                    Context="{Binding Context}" />
            <TextBox Text="{Binding ModelItem.Body.Argument12.Name}"
					         MinWidth="80" />

            <TextBlock VerticalAlignment="Center"
					           Margin="2">
						with name
            </TextBlock>

            <sapv:ExpressionTextBox Expression="{Binding Path=ModelItem.ResolutionName12, Converter={StaticResource expressionConverter}}"
					                        ExpressionType="s:String"
					                        OwnerActivity="{Binding ModelItem}"
					                        Margin="2" />
          </StackPanel>

          <StackPanel Orientation="Horizontal"
				            Margin="2"
				            Grid.Row="2" Visibility="{Binding Path=ModelItem.Argument13Visible}">
            <sapv:TypePresenter Width="120"
					                    Margin="5"
					                    AllowNull="true"
					                    BrowseTypeDirectly="false"
					                    Label="Target type"
					                    Type="{Binding Path=ModelItem.ArgumentType13, Mode=TwoWay, Converter={StaticResource modelItemConverter}}"
					                    Context="{Binding Context}" />
            <TextBox Text="{Binding ModelItem.Body.Argument13.Name}"
					         MinWidth="80" />

            <TextBlock VerticalAlignment="Center"
					           Margin="2">
						with name
            </TextBlock>

            <sapv:ExpressionTextBox Expression="{Binding Path=ModelItem.ResolutionName13, Converter={StaticResource expressionConverter}}"
					                        ExpressionType="s:String"
					                        OwnerActivity="{Binding ModelItem}"
					                        Margin="2" />
          </StackPanel>

          <StackPanel Orientation="Horizontal"
				            Margin="2"
				            Grid.Row="2" Visibility="{Binding Path=ModelItem.Argument14Visible}">
            <sapv:TypePresenter Width="120"
					                    Margin="5"
					                    AllowNull="true"
					                    BrowseTypeDirectly="false"
					                    Label="Target type"
					                    Type="{Binding Path=ModelItem.ArgumentType14, Mode=TwoWay, Converter={StaticResource modelItemConverter}}"
					                    Context="{Binding Context}" />
            <TextBox Text="{Binding ModelItem.Body.Argument14.Name}"
					         MinWidth="80" />

            <TextBlock VerticalAlignment="Center"
					           Margin="2">
						with name
            </TextBlock>

            <sapv:ExpressionTextBox Expression="{Binding Path=ModelItem.ResolutionName14, Converter={StaticResource expressionConverter}}"
					                        ExpressionType="s:String"
					                        OwnerActivity="{Binding ModelItem}"
					                        Margin="2" />
          </StackPanel>

          <StackPanel Orientation="Horizontal"
				            Margin="2"
				            Grid.Row="2" Visibility="{Binding Path=ModelItem.Argument15Visible}">
            <sapv:TypePresenter Width="120"
					                    Margin="5"
					                    AllowNull="true"
					                    BrowseTypeDirectly="false"
					                    Label="Target type"
					                    Type="{Binding Path=ModelItem.ArgumentType15, Mode=TwoWay, Converter={StaticResource modelItemConverter}}"
					                    Context="{Binding Context}" />
            <TextBox Text="{Binding ModelItem.Body.Argument15.Name}"
					         MinWidth="80" />

            <TextBlock VerticalAlignment="Center"
					           Margin="2">
						with name
            </TextBlock>

            <sapv:ExpressionTextBox Expression="{Binding Path=ModelItem.ResolutionName15, Converter={StaticResource expressionConverter}}"
					                        ExpressionType="s:String"
					                        OwnerActivity="{Binding ModelItem}"
					                        Margin="2" />
          </StackPanel>

          <StackPanel Orientation="Horizontal"
				            Margin="2"
				            Grid.Row="2" Visibility="{Binding Path=ModelItem.Argument16Visible}">
            <sapv:TypePresenter Width="120"
					                    Margin="5"
					                    AllowNull="true"
					                    BrowseTypeDirectly="false"
					                    Label="Target type"
					                    Type="{Binding Path=ModelItem.ArgumentType16, Mode=TwoWay, Converter={StaticResource modelItemConverter}}"
					                    Context="{Binding Context}" />
            <TextBox Text="{Binding ModelItem.Body.Argument16.Name}"
					         MinWidth="80" />

            <TextBlock VerticalAlignment="Center"
					           Margin="2">
						with name
            </TextBlock>

            <sapv:ExpressionTextBox Expression="{Binding Path=ModelItem.ResolutionName16, Converter={StaticResource expressionConverter}}"
					                        ExpressionType="s:String"
					                        OwnerActivity="{Binding ModelItem}"
					                        Margin="2" />
          </StackPanel>

        </StackPanel>
        
				<sap:WorkflowItemPresenter Item="{Binding ModelItem.Body.Handler}"
				                           HintText="Drop activity"
				                           Grid.Row="1"
				                           Margin="6" />
			</Grid>
		</DataTemplate>
		<Style x:Key="ExpandOrCollapsedStyle"
		       TargetType="{x:Type ContentPresenter}">
			<Setter Property="ContentTemplate"
			        Value="{DynamicResource Collapsed}" />
			<Style.Triggers>
				<DataTrigger Binding="{Binding Path=ShowExpanded}"
				             Value="true">
					<Setter Property="ContentTemplate"
					        Value="{DynamicResource Expanded}" />
				</DataTrigger>
			</Style.Triggers>
		</Style>
	</sap:ActivityDesigner.Resources>
	<Grid>
		<ContentPresenter Style="{DynamicResource ExpandOrCollapsedStyle}"
		                  Content="{Binding}" />
	</Grid>
</sap:ActivityDesigner>